home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-03 | 2.5 KB | 85 lines | [TEXT/NTP1] |
- //---------------------------------------------------------------------------------
- // Temporary work-around to get sound resources into NTK projects.
- //
- // To use this you must do the following in your NTK project "Project Data" file:
- //
- // Define the constant "pathName" as a text string of the path to the
- // resource file that contains the sound resources you wish to use.
- // Note that this path can be either a full path name or a path relative
- // to your NTK Toolkit folder.
- //
- // Example:
- // constant pathName := ":myProject:sounds.rsrc"
- //
- // Now you can define slots of type "evaluate" and play them like so:
- // mySound := GetSound11( pathName, "boing" );
- // PlaySound( mySound );
- //
- // Discovered the hard way by:
- // Allan Hoeltje
- // Boulder, Colorado USA
- // 303-444-2204
- // August 1993
-
- constant pathName := "Delicious:newt:allan's projects:CheckPlease!:OnOffButton.rsrc";
-
- constant kPackageName := "CheckPlease:ALH";
- constant kAppSymbol := '|CheckPlease:ALH|;
-
- //constant kNone := 0;
- //constant k8Bit := 1;
- //constant kFloat11kRate := 11013.21586;
- //constant kFloat22kRate := 22026.43172;
-
- RemoveScript := func( partName )
- begin
- // If the user removes us then also remove our application options in the system soup.
-
- // I am not sure we should do this. The user may have installed the app on a card and
- // may want to swap cards. Too bad removing the card calls RemoveScript! Maybe
- // someday there will be a RemoveAppScript() and a RemoveCardScript()?
-
- //local s := GetStores()[0]:GetSoup( ROM_SystemSoupName );
- //local c := Query( s, {type: 'index, indexPath: 'tag, startKey: kPackageName} );
-
- //appOpts := c:Entry();
- //if appOpts and StrEqual( appOpts.tag, kPackageName ) then
- // EntryRemoveFromSoup( appOpts );
- end;
-
-
- func myGetSound22( file, name )
- begin
- local rsrcFile := OpenResFileX( file );
- local sndFrame :=
- {
- sndFrameType: 'simpleSound,
- samples: GetSndAsSamples( name ),
- samplingRate: kFloat22kRate,
- dataType: k8Bit,
- compressionType: kNone
- };
- CloseResFileX( rsrcFile );
- return sndFrame;
- end;
-
-
- func myGetSound11( file, name )
- begin
- local rsrcFile := OpenResFileX( file );
- local sndFrame :=
- {
- sndFrameType: 'simpleSound,
- samples: GetSndAsSamplesRate11KHz( name ),
- samplingRate: kFloat11kRate,
- dataType: k8Bit,
- compressionType: kNone
- };
- CloseResFileX( rsrcFile );
- return sndFrame;
- end;
-
- btnSnd := myGetSound11( pathName, "buttonSound" );
-
- //---------------------------------------------------------------------------------
-